package com.lmc.productservice.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope  // 动态获取nacos配置项
@RestController
public class NacosController {
    @Value ("${nacos.config}")  // 从nacos中获取配置项，与配置文件保持一致
    private String nacosConfig;

    @RequestMapping("getConfig")
    public String getConfig() {
        return "从Nacos获取配置项nacos.config:"+nacosConfig;
    }

}
